<?php
header("content-type:text/html; charset=utf-8");
require_once('../lib069/config.php');
$libpath = get_config('lib_path');
require_once("../".$libpath."/clip-string.php");
$curtime = time()*1000;

$sql = "SELECT * FROM pk_current where type='current'";
$query = mysql_fetch_object(mysql_query($sql));

$sql2 = "SELECT * FROM pk_current where type='next'";
$query2 = mysql_fetch_object(mysql_query($sql2));

$timedist = strtotime($query2->kjtime) - strtotime($now);
$timedist = $timedist*1000;
?>

<?php
echo "{\"time\":".$curtime.",\"current\":{\"periodNumber\":". $query->vol .",\"awardTime\":\"". $query->kjtime ."\",\"awardNumbers\":\"". $query->balls ."\"},\"next\":{\"periodNumber\":". $query2->vol .",\"awardTime\":\"". $query2->kjtime ."\",\"awardTimeInterval\":".$timedist.",\"delayTimeInterval\":0}}";

?>